package com.biovr.backend.repository;

import com.biovr.backend.domain.ExpirementReport;
import org.bson.types.ObjectId;
import org.springframework.cglib.core.Predicate;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by monodev on 2017/6/7.
 */
@Repository
public interface ExpirementReportRepository extends MongoRepository<ExpirementReport,String> {
    //根据用户id查找
    @Query("{ 'user._id': ?0}")
    List<ExpirementReport> findByUserId( @Param("userId") ObjectId userId);
//    //根据用户id和expmid查找
//    @Query("{ 'user._id': ?0,'expmId':?1}")
//    ExpirementReport findByUserIdAndExpmId(@Param("userId") ObjectId userId,@Param("expmId") String expmId);
//    //根据学校信息和实验Id查找
//   @Query("{'user.schoolId': ?0,'user.stuMajor._id': ?1,'user.stuClass._id':?2,'user.stuGrade._id':?3,'expmId':?4}")
//      List<ExpirementReport> findBySchoolInfo(
//        @Param("schoolId") String schoolId
//      , @Param("majorId")  ObjectId majorId
//      , @Param("klassId")  ObjectId klassId
//      , @Param("gradeId") ObjectId gradeId
//      , @Param("expmId") String expmId);



    //根据状态查找
    List<ExpirementReport> findByStatusIn(String ... status);

}
